﻿using Services.Equ.PcapCommunication.Abstract;
using SharpPcap;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.NetworkInformation;
using System.Text;
using System.Threading.Tasks;

namespace Services.Equ.PcapCommunication
{
    /// <summary>
    /// 释放链接
    /// </summary>
    public class ReleaseCommunication : AbstractPcapCommunication<bool>
    {
        public ReleaseCommunication(PhysicalAddress destinationMac, string password, ILiveDevice device) : base(destinationMac, password, device)
        {
            ReciveBreak = 1;
            RpcType = 1;
            OpType = 2;
            Status = 0;
            DcpType = 0x20002;
            OptionType = 0x20002;
        }

        public override bool IsResponse(byte[] bytes)
        {
            if (base.IsResponse(bytes))
            {
                return bytes[19] == 2 && bytes[21] == 2;
            }
            else
            {
                return false;
            }
        }
        public override bool ConvertData2Result(byte[] bytes)
        {
            if (bytes[59] == 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        public override byte[] CreateBlockData()
        {
            return [];
        }
        public override byte[] CreateBlock()
        {
            return [];
        }
    }
}
